package com.woniuxy.direct.config;

import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DirectConfig {
    @Bean
    public Queue directQueue1() {
        return new Queue("directQueue1");
    }
    @Bean
    public Queue directQueue2() {
        return new Queue("directQueue2");
    }
    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("directEx");
    }
    @Bean
    public Binding binding1() {
        return BindingBuilder.bind(directQueue1()).to(directExchange()).with("orange");
    }
    @Bean
    public Binding binding2() {
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("black");
    }
    @Bean
    public Binding binding3() {
        return BindingBuilder.bind(directQueue2()).to(directExchange()).with("green");
    }
}
